1
2
3
4
5
6
7
8 package org.votech.ds6.vast.utils;
9
10 import java.awt.Image;
11 import java.net.URL;
12
13
14
15 /***
16 * @author jdt
17 *
18 */
19 public class ResizableImageIcon extends javax.swing.ImageIcon {
20
21 /***
22 *
23 */
24 private static final long serialVersionUID = 1L;
25
26
27 public ResizableImageIcon() {
28 super();
29 }
30
31 public ResizableImageIcon(byte[] arg0, String arg1) {
32 super(arg0, arg1);
33 }
34
35 public ResizableImageIcon(byte[] arg0) {
36 super(arg0);
37 }
38
39 public ResizableImageIcon(Image arg0, String arg1) {
40 super(arg0, arg1);
41 }
42
43 public ResizableImageIcon(Image arg0) {
44 super(arg0);
45 }
46
47 public ResizableImageIcon(String arg0, String arg1) {
48 super(arg0, arg1);
49 }
50
51 public ResizableImageIcon(String arg0) {
52 super(arg0);
53 }
54
55 public ResizableImageIcon(URL arg0, String arg1) {
56 super(arg0, arg1);
57 }
58
59 public ResizableImageIcon(URL arg0) {
60 super(arg0);
61 }
62
63 private Image original;
64
65
66 public void resize(int x, int y) {
67 if (original==null) {
68
69 original = super.getImage();
70 }
71 Image resized = original.getScaledInstance(x,y,Image.SCALE_DEFAULT);
72 super.setImage(resized);
73 }
74
75
76
77
78 }